package com.summer.safe.exception;

import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;

/**
 * 404 异常处理Controller
 * 因为全局异常处理的时候不会处理404异常
 */

@Controller
@RequestMapping(value = "/error")
public class ErrorPageController implements ErrorController {

    @RequestMapping(produces = "text/html", value = "")
    @ResponseStatus(HttpStatus.NOT_FOUND)
    public String errorHtml404() {
        return "/error/404.html";
    }

    @Override
    public String getErrorPath() {
        return null;
    }
}
